using System;
using System.Diagnostics;

/// <summary>
/// Utility methods for method argument testing.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1050:DeclareTypesInNamespaces")]
internal static class ArgTest
{
    [DebuggerStepThrough]
    public static void IsNotNull<T>(T arg) where T : class
    {
        if (arg == null)
        {
            throw new ArgumentNullException();
        }
    }

    [DebuggerStepThrough]
    public static void IsNotNull<T>(T arg, String argName) where T : class
    { 
        if (arg == null) 
        {
            throw new ArgumentNullException(argName);
        }
    }

    [DebuggerStepThrough]
    public static void IsNotNullOrEmpty(String arg, String argName)
    {
        if (String.IsNullOrEmpty (arg))
        {
            throw new ArgumentNullException(argName);
        }
    }
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1050:DeclareTypesInNamespaces")]
internal static class ArgCorrect 
{
    [DebuggerStepThrough]
    public static void EmptyStringIfNull (ref String arg)
    {
        arg = arg ?? "";
    }

}
